package study.designpattern.composite;

import java.util.ArrayList;
import java.util.List;

public class CompositeGraphic implements Graphic{
    List graphics = new ArrayList();
    @Override
    public void print() {
        for(int i=0; i<graphics.size(); i++){
            Graphic graphic = (Graphic) graphics.get(i);
            graphic.print();
        }
        
    }
    
    public void add(Graphic graphic){
        graphics.add(graphic);
    }
    
    public void remove(Graphic graphic) {
        graphics.remove(graphic);
    }
    
}
